define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'management.spec/index',
        add_url: 'management.spec/add',
        edit_url: 'management.spec/edit',
        delete_url: 'management.spec/delete',
        export_url: 'management.spec/export',
        modify_url: 'management.spec/modify',
       
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar:['refresh', 'add'],
                cols: [[
                    // {type: 'checkbox'},
                    {field: 'id', title: 'id',search:false},
                    // {field: 'store_name', title: '所属店铺',selectList: $("#areaId").val(),area:1,areaname:'store_id',width:200,templet:function(d){
                    //     if(d.store_id){
                    //         return "【"+d.store_id+"】"+d.store_name
                    //     }else{
                    //         return "通用"
                    //     }
                       
                    // }},
                    // {field: 'cate_name', title: '所属分类',search:false},
                    {field: 'title', title: '规格名'},
                    {field: 'spec', title: '规格值',search:false,width:300},
                    {field: 'sort', title: '排序', edit: 'text',search:false},
                    // {field: 'status', title: '状态', templet: ea.table.switch,search:false},
                    // {field: 'create_time', title: '创建时间',search:false},
                    {width: 250, title: '操作', templet: ea.table.tool,
                    // operat: [
                    //     [{
                    //         text: '查看规格值',
                    //         url: init.son_url,
                    //         method: 'open',
                    //         auth: 'son',
                    //         class: 'layui-btn layui-btn-xs layui-btn-warm',
                    //         extend: 'data-full="false"',
                    //     },{
                    //         text: '编辑',
                    //         url: init.edit_url,
                    //         method: 'open',
                    //         auth: 'edit',
                    //         class: 'layui-btn layui-btn-xs layui-btn-success',
                    //         extend: 'data-full="false"',
                    //     }],
                    //     'delete'
                    //   ]
                    },
                ]],
            });

            ea.listen();
        },
  
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});